﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ViewProyecto.aspx.cs" Inherits="Proyectos_De_ViewProyecto" %>
<%@ Register Assembly="GMaps" Namespace="Subgurim.Controles" TagPrefix="cc1" %>
<%@ Register Src="wucDesembolsos.ascx" TagName="wucDesembolsos" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
<form runat="server">
    <script type="text/javascript" language="javascript" src="../../resources/utilidades.js"></script>
    <ext:ResourceManager ID="smVerProyecto" runat="server"  Theme="Slate" DirectMethodNamespace="ResourceAjax" />
   
<ext:Store ID="StoreProgramas" runat="server">
    <Reader>
        <ext:JsonReader IDProperty="Key">
            <Fields>
                <ext:RecordField Name="Value">
                </ext:RecordField>
                <ext:RecordField Name="Key">
                </ext:RecordField>
            </Fields>
        </ext:JsonReader>
    </Reader>
</ext:Store>
<ext:Store ID="StoreEstado" runat="server">
    <Reader>
        <ext:JsonReader IDProperty="Key">
            <Fields>
                <ext:RecordField Name="Value">
                </ext:RecordField>
                <ext:RecordField Name="Key">
                </ext:RecordField>
            </Fields>
        </ext:JsonReader>
    </Reader>
</ext:Store>
<ext:Store ID="StoreEje" runat="server">
    <Reader>
        <ext:JsonReader IDProperty="Key">
            <Fields>
                <ext:RecordField Name="Value">
                </ext:RecordField>
                <ext:RecordField Name="Key">
                </ext:RecordField>
            </Fields>
        </ext:JsonReader>
    </Reader>
</ext:Store>
<ext:Store ID="StoreTipo" runat="server">
    <Reader>
        <ext:JsonReader IDProperty="Key">
            <Fields>
                <ext:RecordField Name="Value">
                </ext:RecordField>
                <ext:RecordField Name="Key">
                </ext:RecordField>
            </Fields>
        </ext:JsonReader>
    </Reader>
</ext:Store>
<ext:Store ID="StoreProyectos" runat="server" OnRefreshData="StoreRefresh" AutoLoad="false">
    <Reader>
        <ext:JsonReader IDProperty="Id">
            <Fields>
                <ext:RecordField Name="Id" />
                <ext:RecordField Name="Nombre" />
                <ext:RecordField Name="FechaInicio" />
                <ext:RecordField Name="FechaFin" Type="Date" DateFormat="Y-m-dTh:i:s" />
                <ext:RecordField Name="Presupuesto" />
                <ext:RecordField Name="Latitud" />
                <ext:RecordField Name="Longitud" />
                <ext:RecordField Name="Saldo" />
                <ext:RecordField Name="UltimoPago" />
                <ext:RecordField Name="Descripcion" />
                <ext:RecordField Name="AportePlan" />
                <ext:RecordField Name="AportePlanConDescuento" />
            </Fields>
        </ext:JsonReader>
    </Reader>
    <Proxy>
            <ext:PageProxy></ext:PageProxy>
    </Proxy>
    <BaseParams>
			<ext:Parameter Name="cbxProgramas_bprm" Value="#{cbxProgramas}.getValue()"   Mode="Raw" />
			<ext:Parameter Name="cbxEje_bprm" Value="#{cbxEje}.getValue()"   Mode="Raw" />	
            <ext:Parameter Name="cbxCategorias_bprm" Value="#{cbxCategorias}.getValue()"   Mode="Raw" />
            <ext:Parameter Name="cbxEstado_bprm" Value="#{cbxEstado}.getValue()"   Mode="Raw" />	
            <ext:Parameter Name="txtNombrePrograma_bprm" Value="#{txtNombrePrograma}.getValue()"   Mode="Raw" />		
	</BaseParams>
</ext:Store>

<ext:Viewport ID="Viewport1" runat="server">
    <Items>
        <ext:BorderLayout ID="BorderLayout1" runat="server">
            <North  Split="false">
                <ext:Panel ID="Panel1" BodyStyle="padding:10px;background-color:#E7E4DD;" runat="server"  AutoHeight="true">
                    <Items>
                        <ext:Panel ID="Panel2" runat="server" BodyStyle="background-color:Transparent;" ButtonAlign="Center"  Layout="Column" Height="140">
                            <Items>
                                        <ext:Panel ID="Panel3"  Layout="Form"  ColumnWidth=".33" runat="server" Border="false" Header="false" BodyStyle="padding:10px;background-color:Transparent;">
                                            <Items>
                                                    <ext:ComboBox  AnchorHorizontal="95%" Editable="false" FieldLabel="Eje" ID="cbxEje" StoreID="StoreEje" runat="server"
                                                            DisplayField="Value" ValueField="Key" TypeAhead="true" ForceSelection="true"
                                                            TriggerAction="All" Grow="true" GrowMax="300" EmptyText="Todos" SelectOnFocus="true"
                                                            AutoDataBind="True">
                                                            <Triggers>
                                                                <ext:FieldTrigger Icon="Clear" HideTrigger="true" />
                                                            </Triggers>
                                                            <Listeners>
                                                                <Select Handler="this.triggers[0].show();" />
                                                                <BeforeQuery Handler="this.triggers[0][ this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
                                                                <TriggerClick Handler="if(index == 0) { this.clearValue(); this.triggers[0].hide(); }" />
                                                            </Listeners>
                                                        </ext:ComboBox>
                                                     <ext:ComboBox  AnchorHorizontal="95%" Editable="false" FieldLabel="Estado" ID="cbxEstado" runat="server"
                                                            StoreID="StoreEstado" DisplayField="Value" ValueField="Key" TypeAhead="true"
                                                            ForceSelection="true" TriggerAction="All" Grow="true" GrowMax="300" EmptyText="Todos"
                                                            SelectOnFocus="true" AutoDataBind="True">
                                                            <Triggers>
                                                                <ext:FieldTrigger Icon="Clear" HideTrigger="true" />
                                                            </Triggers>
                                                            <Listeners>
                                                                <Select Handler="this.triggers[0].show();" />
                                                                <BeforeQuery Handler="this.triggers[0][ this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
                                                                <TriggerClick Handler="if(index == 0) { this.clearValue(); this.triggers[0].hide(); }" />
                                                            </Listeners>
                                                        </ext:ComboBox>
                                            </Items>
                                        </ext:Panel>
                                   
                                        <ext:Panel ID="Panel4"  Layout="Form"  ColumnWidth=".34" Height="70" runat="server" Border="false" BodyStyle="padding:10px;background-color:Transparent;">
                                            <Items>
                                                       <ext:ComboBox  AnchorHorizontal="95%"  Editable="false" FieldLabel="Programa" ID="cbxProgramas" runat="server"
                                                            StoreID="StoreProgramas" DisplayField="Value" ValueField="Key" TypeAhead="true"
                                                            ForceSelection="true" TriggerAction="All" Grow="true" GrowMax="300" EmptyText="Todos"
                                                            SelectOnFocus="true" AutoDataBind="True">
                                                            <Triggers>
                                                                <ext:FieldTrigger Icon="Clear" HideTrigger="true" />
                                                            </Triggers>
                                                            <Listeners>
                                                                <Select Handler="this.triggers[0].show();" />
                                                                <BeforeQuery Handler="this.triggers[0][ this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
                                                                <TriggerClick Handler="if(index == 0) { this.clearValue(); this.triggers[0].hide(); }" />
                                                            </Listeners>
                                                        </ext:ComboBox>
                                                    
                                                        <ext:TextField  AnchorHorizontal="95%" FieldLabel="Nombre" ID="txtNombrePrograma" runat="server" />
                                                   
                                            </Items>
                                        </ext:Panel>
                                   
                                        <ext:Panel ID="Panel5"  Layout="Form" ColumnWidth=".33" Height="70" runat="server" Border="false" BodyStyle="padding:10px;background-color:Transparent;">
                                            <Items>
                                               
                                                        <ext:ComboBox  AnchorHorizontal="95%" Editable="false" FieldLabel="Tipo" ID="cbxCategorias" StoreID="StoreTipo"
                                                            runat="server" DisplayField="Value" ValueField="Key" TypeAhead="true" ForceSelection="true"
                                                            TriggerAction="All" Grow="true" GrowMax="300" EmptyText="Todos" SelectOnFocus="true"
                                                            AutoDataBind="True">
                                                            <Triggers>
                                                                <ext:FieldTrigger Icon="Clear" HideTrigger="true" />
                                                            </Triggers>
                                                            <Listeners>
                                                                <Select Handler="this.triggers[0].show();" />
                                                                <BeforeQuery Handler="this.triggers[0][ this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
                                                                <TriggerClick Handler="if(index == 0) { this.clearValue(); this.triggers[0].hide(); }" />
                                                            </Listeners>
                                                        </ext:ComboBox>
                                                 
                                            </Items>
                                        </ext:Panel>
                                 
                            </Items>
                            <Buttons>
                                <ext:Button runat="server" ID="btnBuscar" Text="Buscar" Icon="Find">
                                    <%--
                                    <DirectEvents>
                                        <Click OnEvent="btnBuscar_Click">
                                            <EventMask ShowMask="true" />
                                        </Click>
                                    </DirectEvents>
                                    --%>
                                    <Listeners>
                                      <Click Handler="#{StoreProyectos}.load();" />
                                    </Listeners>
                                </ext:Button>
                            </Buttons>
                        </ext:Panel>
                    </Items>
                </ext:Panel>
            </North>
            <Center Margins-Top="130">
                <ext:GridPanel ID="GridPanelProyectos" runat="server" StoreID="StoreProyectos" StripeRows="true"
                    AutoWidth="true" Height="250px" Title="Proyectos" AutoExpandColumn="Descripcion">
                    <ColumnModel ID="ColumnModel1" runat="server">
                        <Columns>
                              <ext:CommandColumn Header="Opción">
                                <Commands>
                                    <ext:GridCommand CommandName="Desembolso" Text="Desembolsos" Icon="MoneyAdd" ToolTip-Text="Editar para ver y/o agregar desembolsos al proyecto">
                                    </ext:GridCommand>
                                </Commands>
                            </ext:CommandColumn>

                            <ext:Column ColumnID="NombreProyecto" Header="Nombre del proyecto" Width="200" Sortable="true"
                                DataIndex="Nombre" />
                            <ext:Column ColumnID="Descripcion" Header="Descripcion" Width="150" Sortable="true"
                                DataIndex="Descripcion">
                            </ext:Column>
                            <ext:Column Header="Presupuesto" Width="150" Sortable="true" DataIndex="Presupuesto">
                                <Renderer Format="UsMoney" />
                            </ext:Column>
                            <ext:Column Header="Aporte Plan" Width="140" Sortable="true" DataIndex="AportePlanConDescuento">
                                <Renderer Format="UsMoney" />
                            </ext:Column>
                            <ext:Column Header="Ultimo Pago" Width="140" Sortable="true" DataIndex="UltimoPago">
                                <Renderer Format="UsMoney" />
                            </ext:Column>
                            <ext:Column Header="Saldo por desembolsar" Width="140" Sortable="true" DataIndex="Saldo">
                                <Renderer Format="UsMoney" />
                            </ext:Column>
                          
                        </Columns>
                    </ColumnModel>
                    <DirectEvents>
                        <Command OnEvent="VerDesembolso">
                            <ExtraParams>
                                <ext:Parameter Name="Comando" Value="command" Mode="Raw" Encode="False" />
                                <ext:Parameter Name="Id" Value="record.data.Id" Mode="Raw" />
                            </ExtraParams>
                        </Command>
                    </DirectEvents>
                    <SelectionModel>
                        <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true">
                        </ext:RowSelectionModel>
                    </SelectionModel>
                    <BottomBar>
                        <ext:PagingToolbar ID="ptbPerfilProyecto" runat="server" StoreID="StoreProyectos"
                            DisplayInfo="true" DisplayMsg="Proyectos {0} - {1} of {2}" EmptyMsg="No existen Proyectos" />
                    </BottomBar>
                </ext:GridPanel>
            </Center>
        </ext:BorderLayout>
    </Items>
</ext:Viewport>
<uc1:wucDesembolsos runat="server" ID="wucDesembolsos1"></uc1:wucDesembolsos>

</form>
</body>
</html>
